# nagios-client/nrpe

---
# install pkgs:
- name: install nagios client pkgs
  yum: name=$item state=installed
  with_items:
  - nrpe
  - nagios-plugins
  - nagios-plugins-disk
  - nagios-plugins-file_age
  - nagios-plugins-users
  - nagios-plugins-procs
  - nagios-plugins-swap
  - nagios-plugins-load
  - nagios-plugins-ping
  tags:
  - packages

- name: install local nrpe check scripts that are not packaged
  copy: src=$files/nagios/client/scripts/$item dest=/usr/lib64/nagios/plugins/$item mode=0755 owner=nagios group=nagios
  with_items:
  - check_postfix_queue
  - check_raid.py
  - check_lock

# create dirs
# puppet used to make /var/spool/nagios (owned by nagios.nagios) mode 750
# and /usr/lib/nagios/plugins (owned by root) mode 755 - but we don't know WHY 
# then stuff it with plugins from the plugins dir in the nagios module
# then we symlinked that to /usr/lib64/nagios/plugins
# it was a nightmare - don't do that - my ghost will haunt you if you do
# skvidal 2013-05-21


# FIXME? figure out nrpe selinux policy of DOOM is needed

- name: /etc/nagios/nrpe.cfg
  template: src=$files/nagios/client/nrpe.cfg dest=/etc/nagios/nrpe.cfg
  notify:
  - restart nrpe
  tags:
  - config

- name: install nrpe client configs
  template: src=$files/nagios/client/$item dest=/etc/nrpe.d/$item
  with_items:
  - check_mirrorlist_cache.cfg
  - check_raid.cfg
  - check_cron.cfg
  - check_disk.cfg
  - check_swap.cfg
  - check_postfix_queue.cfg
  - check_lock.cfg
  notify:
  - restart nrpe
  tags:
  - config

- name: nrpe service start
  service: name=nrpe state=running enabled=true
  tags:
  - service
